import "../../../just/libafl-qemu.just"
import "libafl_qemu_asan_guest/Justfile"
import "libafl_qemu_asan_host/Justfile"
import "libafl_qemu_asan_nolibc/Justfile"
import "../../libafl_asan/fuzzer_name.just"

build: build_guest build_host build_nolibc

pretty_rust:
  #!/bin/sh
  MAIN_LLVM_VERSION=$LLVM_VERSION cargo run --manifest-path ../../utils/libafl_repo_tools/Cargo.toml --release -- -v

pretty_toml:
  #!/bin/sh
  taplo fmt

pretty: pretty_rust pretty_toml

fix: fix_guest fix_host fix_nolibc

clippy:
  #!/bin/sh
  cargo clippy -F test

all: fix pretty build clippy

build_arm_dev:
  #!/bin/sh
  ARCH=arm PROFILE=dev just build

build_aarch64_dev:
  #!/bin/sh
  ARCH=aarch64 PROFILE=dev just build

build_x86_64_dev:
  #!/bin/sh
  ARCH=x86_64 PROFILE=dev just build

build_i386_dev:
  #!/bin/sh
  ARCH=i386 PROFILE=dev just build

build_ppc_dev:
  #!/bin/sh
  RUSTC_BOOTSTRAP=1 \
  RUSTFLAGS="--cfg rustix_use_experimental_asm" \
  ARCH=ppc PROFILE=dev just build

build_arm_release:
  #!/bin/sh
  ARCH=arm PROFILE=release just build

build_aarch64_release:
  #!/bin/sh
  ARCH=aarch64 PROFILE=release just build

build_x86_64_release:
  #!/bin/sh
  ARCH=x86_64 PROFILE=release just build

build_i386_release:
  #!/bin/sh
  ARCH=i386 PROFILE=release just build

build_ppc_release:
  #!/bin/sh
  RUSTC_BOOTSTRAP=1 \
  RUSTFLAGS="--cfg rustix_use_experimental_asm" \
  ARCH=ppc PROFILE=release just build

build_everything_dev: \
  build_arm_dev \
  build_aarch64_dev \
  build_x86_64_dev \
  build_i386_dev \
  build_ppc_dev \

build_everything_release: \
  build_arm_release \
  build_aarch64_release \
  build_x86_64_release \
  build_i386_release \
  build_ppc_release \

build_everything: build_everything_dev build_everything_release

everything: build_everything clippy
